package com.xiaor.rssmodel.model;

import com.xiaor.rssmodel.model.common.Common;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.UUID;

/**
 * 历史人物图片
 */
@Entity
@Table(name = "fimage")
@Data   //生成Getter和Setter
@NoArgsConstructor  //生成无参构造函数
@AllArgsConstructor //生成有参构造函数
public class FImage extends Common {
    @Column(columnDefinition = "varchar(255) comment '图片唯一标识'", unique = true)
    private String uuid = UUID.randomUUID().toString();
    @ManyToOne
    @JoinTable(name = "figure_fimage",
            joinColumns = {@JoinColumn(name = "mid")},
            inverseJoinColumns = {@JoinColumn(name = "fid")}
    )
    private Figure figure;

    @Override
    public String toString() {
        return "FImage{" +
                "uuid='" + uuid + '\'' +
                '}';
    }
}
